//
//  StatusesModel.swift
//  SwiftWB
//
//  Created by 钟清 on 17/4/1.
//  Copyright © 2017年 Zhong Qing. All rights reserved.
//

import UIKit

class StatusesModel: NSObject {
    /* 微博创建时间 */
    var created_at: String?
    /* 字符串型的微博ID */
    var idstr: String?
    /* 微博信息内容 */
    var text: String?
    /* 微博来源 */
    var source: String?
    /* 用户信息 */
    var user: UserModel?
    /* 配图地址数组 */
    var pic_urls: [[String : AnyObject]]?
    /* 转发微博 */
    var retweeted_status: StatusesModel?
    
    init(dict: [String : AnyObject]) {
        super.init()
        setValuesForKeysWithDictionary(dict)
    }
    
    override func setValue(value: AnyObject?, forKey key: String) {
        if key == "user" {
            user = UserModel(dict: value as! [String : AnyObject])
            return
        }
        if key == "retweeted_status" {
            retweeted_status = StatusesModel(dict: value as! [String : AnyObject])
            return
        }
        super.setValue(value, forKey: key)
    }
    
    override func setValue(value: AnyObject?, forUndefinedKey key: String) {
        
    }
    
    // FIXME: 快速调试
    override var description: String {
        let property = ["created_at","idstr","text","source"]
        let dict = dictionaryWithValuesForKeys(property)
        return "\(dict)"
    }

}
